package com.yiboshi.rehrs.helper.core;

import com.yiboshi.rehrs.util.AperStringUtils;
import com.yiboshi.rehrs.util.SHA256Util;
import com.yiboshi.rehrs.util.StrUtils;

import java.util.Map;

public interface HeaderHelper {


    //生产可用的header cps和qi5
    Map<String,String> incept(String type,int count) throws Exception;



    // 添加默认方法实现
    default void sign(Map<String,String> tokenMap,String type) throws Exception {
        String pda_user_token = tokenMap.get("pda_user_token");
        if(pda_user_token==null){
            pda_user_token = "";
        }
        String person_no = tokenMap.get("person_no");
        String Jdpt_req_time = (System.currentTimeMillis()+1000+AperStringUtils.randomNum(1000))+"";
        String Jdpt_sign = SHA256Util.Jdpt_sign(Jdpt_req_time, pda_user_token,person_no);
        tokenMap.put("jdpt_sign", Jdpt_sign);
        tokenMap.put("jdpt_req_time",Jdpt_req_time);
        if(type!=null&&type.contains("newCallAndFile")){
            tokenMap.put("user-agent","okhttp/3.10.0");
            tokenMap.put("content-type","application/x-www-form-urlencoded; charset=utf-8");
        }
    }
}
